﻿using System;
using NUnit.Framework;

namespace Ucto.ToExcelConvertor.Tests
{
	[TestFixture]
	public class ValueToExcelHandlerFixture : BaseFixture
	{
		[Test]
		public void Handle()
		{
			// arrage
			int columnCount = 2;
			int rowCount = 3;

			var sheet = this.Factory.GetExcelSheetMock();
			var handler = this.Factory.GetValueToExcelHandler(columnCount, sheet);

			// act (2x3)
			for (int y = 1; y < rowCount + 1; y++)
			{
				for (int x = 1; x < columnCount + 1; x++)
				{
					handler.Handle(MockResources.FirstValue);
					
					// assert
					Assert.That(sheet.Cell, Is.Not.Null);
					Assert.That(sheet.Cell, Is.TypeOf<double>());
					Assert.That(sheet.X, Is.EqualTo(x));
					Assert.That(sheet.Y, Is.EqualTo(y));
				}
			}
		}
	}
}
